From 000a079b52015e5edf2c1c537a435f6a9fc963db Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Sun, 27 Aug 2017 16:31:16 +0900 Subject: [PATCH] Fix remaining test failures --- tests/features.rs | 11 +++++++++++ tests/git.rs | 2 ++ tests/path.rs | 2 +- tests/run.rs | 2 ++ tests/test.rs | 25 ++++++++++++++++++------- 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/tests/features.rs b/tests/features.rs index 7aec1b99e..bbc78b942 100644 --- a/tests/features.rs +++ b/tests/features.rs @@ -516,7 +516,9 @@ fn groups_on_groups_on_groups() { optional = true "#) .file("src/main.rs", r#" + #[allow(unused_extern_crates)] extern crate bar; + #[allow(unused_extern_crates)] extern crate baz; fn main() {} "#) @@ -562,7 +564,9 @@ fn many_cli_features() { optional = true "#) .file("src/main.rs", r#" + #[allow(unused_extern_crates)] extern crate bar; + #[allow(unused_extern_crates)] extern crate baz; fn main() {} "#) @@ -607,6 +611,7 @@ fn union_features() { features = ["f2"] "#) .file("src/main.rs", r#" + #[allow(unused_extern_crates)] extern crate d1; extern crate d2; fn main() { @@ -1100,7 +1105,9 @@ fn many_cli_features_comma_delimited() { optional = true "#) .file("src/main.rs", r#" + #[allow(unused_extern_crates)] extern crate bar; + #[allow(unused_extern_crates)] extern crate baz; fn main() {} "#) @@ -1154,9 +1161,13 @@ fn many_cli_features_comma_and_space_delimited() { optional = true "#) .file("src/main.rs", r#" + #[allow(unused_extern_crates)] extern crate bar; + #[allow(unused_extern_crates)] extern crate baz; + #[allow(unused_extern_crates)] extern crate bam; + #[allow(unused_extern_crates)] extern crate bap; fn main() {} "#) diff --git a/tests/git.rs b/tests/git.rs index 369ed7f14..ca0f209f3 100644 --- a/tests/git.rs +++ b/tests/git.rs @@ -644,7 +644,9 @@ fn update_with_shared_deps() { path = "dep2" "#) .file("src/main.rs", r#" + #[allow(unused_extern_crates)] extern crate dep1; + #[allow(unused_extern_crates)] extern crate dep2; fn main() {} "#) diff --git a/tests/path.rs b/tests/path.rs index 1003c09ed..e07334c61 100644 --- a/tests/path.rs +++ b/tests/path.rs @@ -744,7 +744,7 @@ fn dev_deps_no_rebuild_lib() { doctest = false "#) .file("src/lib.rs", r#" - #[cfg(test)] extern crate bar; + #[cfg(test)] #[allow(unused_extern_crates)] extern crate bar; #[cfg(not(test))] pub fn foo() { env!("FOO"); } "#) .file("bar/Cargo.toml", r#" diff --git a/tests/run.rs b/tests/run.rs index 83d957b81..569288615 100644 --- a/tests/run.rs +++ b/tests/run.rs @@ -280,10 +280,12 @@ fn specify_name() { "#) .file("src/lib.rs", "") .file("src/bin/a.rs", r#" + #[allow(unused_extern_crates)] extern crate foo; fn main() { println!("hello a.rs"); } "#) .file("src/bin/b.rs", r#" + #[allow(unused_extern_crates)] extern crate foo; fn main() { println!("hello b.rs"); } "#); diff --git a/tests/test.rs b/tests/test.rs index b4dc3b0c6..017a39d80 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -331,6 +331,7 @@ fn test_with_lib_dep() { #[test] fn lib_test() {} "#) .file("src/main.rs", " + #[allow(unused_extern_crates)] extern crate foo; fn main() {} @@ -364,6 +365,7 @@ fn test_with_deep_lib_dep() { path = "../foo" "#) .file("src/lib.rs", " + #[cfg(test)] extern crate foo; /// ``` /// bar::bar(); @@ -587,6 +589,7 @@ fn lib_bin_same_name() { #[test] fn lib_test() {} ") .file("src/main.rs", " + #[allow(unused_extern_crates)] extern crate foo; #[test] @@ -1288,7 +1291,7 @@ fn selective_testing() { doctest = false "#) .file("d1/src/lib.rs", "") - .file("d1/src/main.rs", "extern crate d1; fn main() {}") + .file("d1/src/main.rs", "#[allow(unused_extern_crates)] extern crate d1; fn main() {}") .file("d2/Cargo.toml", r#" [package] name = "d2" @@ -1300,7 +1303,7 @@ fn selective_testing() { doctest = false "#) .file("d2/src/lib.rs", "") - .file("d2/src/main.rs", "extern crate d2; fn main() {}"); + .file("d2/src/main.rs", "#[allow(unused_extern_crates)] extern crate d2; fn main() {}"); p.build(); println!("d1"); @@ -1361,6 +1364,7 @@ fn almost_cyclic_but_not_quite() { path = ".." "#) .file("b/src/lib.rs", r#" + #[allow(unused_extern_crates)] extern crate a; "#) .file("c/Cargo.toml", r#" @@ -1388,8 +1392,14 @@ fn build_then_selective_test() { [dependencies.b] path = "b" "#) - .file("src/lib.rs", "extern crate b;") - .file("src/main.rs", "extern crate b; extern crate a; fn main() {}") + .file("src/lib.rs", "#[allow(unused_extern_crates)] extern crate b;") + .file("src/main.rs", r#" + #[allow(unused_extern_crates)] + extern crate b; + #[allow(unused_extern_crates)] + extern crate a; + fn main() {} + "#) .file("b/Cargo.toml", r#" [package] name = "b" @@ -1570,7 +1580,7 @@ fn example_with_dev_dep() { path = "a" "#) .file("src/lib.rs", "") - .file("examples/ex.rs", "extern crate a; fn main() {}") + .file("examples/ex.rs", "#[allow(unused_extern_crates)] extern crate a; fn main() {}") .file("a/Cargo.toml", r#" [package] name = "a" @@ -1822,6 +1832,7 @@ fn cyclic_dev_dep_doc_test() { foo = { path = ".." } "#) .file("bar/src/lib.rs", r#" + #[allow(unused_extern_crates)] extern crate foo; "#); assert_that(p.cargo_process("test"), @@ -2179,7 +2190,7 @@ fn panic_abort_multiple() { [profile.release] panic = 'abort' "#) - .file("src/lib.rs", "extern crate a;") + .file("src/lib.rs", "#[allow(unused_extern_crates)] extern crate a;") .file("a/Cargo.toml", r#" [package] name = "a" @@ -2296,7 +2307,7 @@ fn test_release_ignore_panic() { [profile.release] panic = 'abort' "#) - .file("src/lib.rs", "extern crate a;") + .file("src/lib.rs", "#[allow(unused_extern_crates)] extern crate a;") .file("a/Cargo.toml", r#" [package] name = "a" -- 2.30.2